

const { ccclass, property } = cc._decorator;

@ccclass
export default class ScrollViewCom extends cc.Component {

    @property(cc.ScrollView)
    scrollview: cc.ScrollView = null;

    @property(cc.Float)
    tolerantSpace = 40;

    private onScrollEvent(event) {
        return;
        let itemList = this.scrollview.content.children;
        for (let i in itemList) {
            //超出屏幕的，就不会让其渲染
            let item = itemList[i];
            let maxHeight = item.height / 2 + this.tolerantSpace;
            let minHeight = -(this.scrollview.content.parent.height + item.height + this.tolerantSpace);

            if (item.y >= maxHeight || item.y < minHeight) {
                item.opacity = 0;
            } else {
                item.opacity = 255;
            }
        }
    }
}
